<include file="Public:header" />
<div class="page-member subpage">
    <div class="form-header">
        <div>
            <div class="line1">
                <div class="fl"><h3>用户信息 / 个人资料</h3></div>
            </div>
            <div class="line2">
                <div class="fl form-btn-group">
                    <button onclick="submitForm();" class="btn-save btn-highlight">修 改</button>
                    <span>或</span>
                    <a onclick="window.history.back();" class="linkBtn btn-abort" href="javascript:void(0);">放弃</a>
                </div>
            </div>
        </div>
    </div>
    <div class="form-box2">
        <div>
            <form id="userForm" method="post" action="">
                <table class="form">
                    <tr>
                        <th width="15%">用户名<span class="hint">*</span></th>
                        <td width="35%">{$user.username}</td>
                        <th width="15%">角色</th>
                        <td>{$u.role_name}</td>
                    </tr>
                    <tr>
                        <th>工作单位<span class="hint">*</span></th>
                        <td>{$u.company_name}</td>
                        <th>职位</th>
                        <td><input name="title" type="text" value="{$user.title}" /> </td>
                    </tr>
                    <tr>
                        <th>联系电话</th>
                        <td><input name="phone" type="text" value="{$user.phone}" /> </td>
                        <th></th>
                        <td></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<script>
    function submitForm() {
        var title = $("input[name=title]").val();
        var phone = $("input[name=phone]").val();
        $.ajax({
            url:"/admin/user/updateProfile",
            data: {title:title, phone:phone},
            type:"POST", dataType:"JSON",
            success: function(data){
                if(data.status){
                    alert("资料修改成功");
                }else{
                    alert(data.info);
                }
            }
        });
    }
</script>
<include file="Public:footer" />
